/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.skipass;

/**
 *
 * @author Brothers
 */
public class Turnstile {

    private final int id;
    private AccountingSystem sys;
    private long allAccessTrue = 0;
    private long allAccessFalse = 0;

    public Turnstile(AccountingSystem system) {
        this.id = system.getIdCounter();
        this.sys = system;
    }

    public int getId() {
        return this.id;
    }

    public boolean access(SkiPass pass) {

        return sys.checkPass(pass, this.getId());
    }

    protected void plusAccessFalse() {
        this.allAccessFalse++;
    }

    public long getAllaccessTrue() {
        return this.allAccessTrue;
    }

    public long getAllaccessFalse() {
        return this.allAccessFalse;
    }

    protected void plusAccessTrue() {
        this.allAccessTrue++;
    }

}
